package com.share.spring;

import com.share.config.SpringConfig;
import com.share.service.PersonService;
import com.share.service.PersonServiceImpl;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * author:caifan
 * date:2019/9/23
 */
public class IOCExample_02 {

    public IOCExample_02() {
        System.out.println(this.toString());
    }
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        PersonService personService = (PersonService) context.getBean(PersonServiceImpl.class);
        System.out.println(personService.getPersonByName("1111"));
        System.out.println(new IOCExample_02());
    }
}
